<?php
     //接受传递的分类的id
	 $id=$_GET['id'];
	     //引入配置文件
	 require '../public/config.php';
	 require '../public/mysql.php';
	 require '../public/function.php';
	   session_start();
	 @$name= $_SESSION['admin']['user'];
	 //连接数据库查询出所有的分类
	$link= connect();
	//准备SQL和执行sql
	if($link['error']){
	    $sql="select * from category";
	    $cates =query($link['mess'],$sql);
	}
   //调用查询子类的函数
   $childs = getChild($cates,$id);
   //将子类的数组转为以逗号分隔的字符串
    $childStr=implode(',',$childs);
//    var_dump($childStr);
	//查询出该分类下面所有的商品
   $sql="select * from goods where cid in($childStr)";
     //执行SQL语句
	 if($link['error']){
	   $goods =query($link['mess'],$sql);
	 }
//	 var_dump($goods);
?>


<html>
    <head>
	    <title>列表详情</title>
		<meta charset="utf-8">
		<link type="text/css" rel="stylesheet" href="style/reset.css">
		<link type="text/css" rel="stylesheet" href="style/lbxq.css">
	</head>

    <body>
	    <div class="headerBar">
		
		<div class="topBar">
		        <div class="comWidth">
				     <?php if (empty($_SESSION['admin']['user']) ) :?>
					<a href="./web/login.php">登录</a>
					<a href="./web/adduser.php">注册</a>
					<?php else :?>
					<p>欢迎回来，<?php echo $_SESSION['admin']['user'];?>
					<a href="./web/action.php?a=logout">退出</a></p>
					<?php endif;?>
				</div>
		</div>

         <div class="logoBar">
		      <div class="comWidth">
			      <div class="logo fl">
				    <a href="#"><img src="./images/logo.jpg" alt="汤浅蓄电池"></a>
				  </div>
				  <div class="search_box fl">
				      <input type="text" class="search_text fl">
					  <input type="button" value="搜 索" class="search_btn fr">
				  </div>
				  <div class="shopCar fr">
				      <span class="shopText fl">购物车</span>
					  <span class="shopNum fl">0</span>
				  </div>
			  </div>
		 </div>
<!--  导航-->
        <div class="nav">
		<div class="comWidth">
		   <div class="nav_left">
		     <h3>全部商品分类</h3>  
		   </div>
		    <ul class="nav_right">
			   <li class="nav_active1">电瓶上门</li>
			   <li class="nav_active">轮胎</li>
			   <li class="nav_active">保养</li>
			   <li class="nav_active">车品</li>
			   <li class="nav_active">轮毂</li>
			   <li class="nav_active">服务门店</li>
		    </ul>
		
		
		</div>
		</div>  

<!-- 内容 -->       
<div class="mainContent comWidth">
		<div class="leftArea fl">
			<div class="left-title">
				<h3>车品</h3>
			</div>
			<div class="left-item">
				<dl>
					<dt>车载电器</dt>
					<dd>
						<a href="#">净化器</a>
						<a href="#">吸尘器</a>
						<a href="#">行车记录仪</a>
						<a href="#">冷暖箱</a>
						<a href="#">应急电源</a>
						<a href="#">电子狗</a>
						<a href="#">无人机</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>汽车装饰</dt>
					<dd>
						<a href="#">香水</a>
						<a href="#">手机支架</a>
						<a href="#">后备箱垫</a>
						<a href="#">头枕靠腰</a>
						<a href="#">防车内饰品 </a>
						<a href="#">方向盘套</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>美容清洗</dt>
					<dd>
						<a href="#">车蜡</a>
						<a href="#">补漆笔</a>
						<a href="#">清洁工具</a>
						<a href="#">玻璃水</a>
						<a href="#">竹炭包</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>镜头</dt>
					<dd>
						<a href="#">单反镜头</a>
						<a href="#">微单镜头</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>摄像机</dt>
					<dd>
						<a href="#">全部</a>
						<a href="#">索尼</a>
						<a href="#">松下</a>
						<a href="#">佳能</a>
						<a href="#">三星</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>摄像配件</dt>
					<dd>
						<a href="#">相机包</a>
						<a href="#">相机电池</a>
						<a href="#">贴膜</a>
						<a href="#">滤镜</a>
						<a href="#">三脚架</a>
						<a href="#">闪光灯</a>
						<a href="#">遮光罩</a>
						<a href="#">遥控器</a>
						<a href="#">专业配件</a>
						<a href="#">清洁用品</a>
						<a href="#">望远镜</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>数码储存</dt>
					<dd>
						<a href="#">刻录盘片</a>
						<a href="#">盘片附件</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
			<div class="left-item">
				<dl>
					<dt>电子教育</dt>
					<dd>
						<a href="#">电子书</a>
						<a href="#">电子词典</a>
						<a href="#">幼儿教育</a>
						<a href="#">智能学习</a>
						<a href="#">录音笔</a>
					</dd>
				</dl>
			</div>  <!-- item end -->
		</div>
		<div class="rightArea fr">
			<div class="banner">
				<div class="banner-bar fr">
					<ul class="imgBox">
				
					</ul>
					<div class="num">
						<a href="#" class="num-active"></a><a href="#"></a><a href="#"></a>
					</div>
				</div><!-- banner-bar end 可复用 -->
			</div><!--  banner end -->
			<div class="product-list-item cl">
				<div class="item-title">
					<h3>电子狗</h3>
				</div>
				<div class="item-info">
					<ul>
					        <?php foreach ($goods as $val) :?>
						<li>
						<?php
									$path = '../public/upload/'.$val['pic'];
								?>
							<div class="picBox"><a href="./goods.php?id=<?php echo $val['id']?>"><img src="<?php echo $path;?>" alt="商品-电子狗"></a></div>
							<a href="#" class="products-des"><?php echo $val['name']?></a>
							<span class="products-price">￥<?php echo $val['price']?></span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(79条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<?php endforeach;?>



					</ul>
				</div>
			</div> <!-- product-list-item end -->
			<div class="product-list-item cl">
				<div class="item-title">
					<h3>保温箱</h3>
				</div>
				<div class="item-info">
					<ul>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						<li>
							<div class="picBox"><img src="images/bw.jpg" alt="商品-bw"></div>
							<a href="#" class="products-des">科勒曼/COLEMAN 28升手挽保温箱（蓝色竖标）3000001999</a>
							<span class="products-price">￥799.00</span>
							<div class="comment">
								<span>评论:</span><div class="score"></div><a href="#">(999条)</a>
							</div> <!-- 评论部分结束 -->
						</li>
						
					</ul>
				</div>
			</div> <!-- product-list-item end -->
		</div>
	</div>
	
<!-- 商品详情结束 -->
<!--底部   -->
                         <div class="hr"></div>
						 <div class="footer">
                            <p><a href="#">汤浅简介</a><i>|</i><a href="#">招兵买马</a><i>|</i><a href="#">汤浅新闻</a><i>|</i><a href="#">广告与市场合作</a><i>|</i><a href="#">联系我们</a></p>
                            <p>© 2004-2016 beixing.cn Corporation, All Rights Reserved 北星苏州有限公司 版权所有 苏ICP备11004912号</p>
                            <p class="web"><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a></p>
						</div>




























	</body>
</html>